#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main()
{
	while (1)
	{
		char arr[101] = { 0 };
		char ch;
		int i = 0;
		while ((ch = getchar()) != '\n')
		{
			arr[i++] = ch;
		}
		if (strcmp(arr, "stop") == 0)
		{
			break;
		}
		int sum = 0;
		int n = 0;
		while (arr[n] != '\0')
		{
			if (arr[n] != ' ')
			{
				sum++;
			}
			n++;
		}
		char* base = " ";
		char* tem;
		int len = 0;
		int maxlen = 0;
		char* start = 0;
		for (tem = strtok(arr, base); tem != NULL; tem = strtok(NULL, base))
		{
			len = strlen(tem);
			if (len > maxlen)
			{
				maxlen = len;
				start = tem;
			}
		}
		printf("%d ", sum);
		for (char* i = start; i < start + maxlen; i++)
		{
			printf("%c", *i);
		}
		printf("\n");
	}
}